package tuiLayer;
import java.util.Scanner;

/**
 * Write a description of class MainMenuUI here.
 * 
 * @author (Tobais) 
 * @version (0.1)
 */
public class MainMenuUI
{
    FriendsMenuUI friends;
    DVDsMenuUI dvds;
    LoanMenuUI loan;
    
    public MainMenuUI()
    {
        friends = new FriendsMenuUI();
        dvds = new DVDsMenuUI();
        loan = new LoanMenuUI();
        startProcessing();
    }
    
    public void startProcessing()
    {
        System.out.println("***MainMenu***");
        System.out.println("1. Friends");
        System.out.println("2. DVDs");
        System.out.println("3. Loan");
        System.out.println("4. Close");
        System.out.println("Make your choice");
        processInput();
    }
    
    private void processInput()
    {
        Scanner scanner = new Scanner(System.in);
        int result = scanner.nextInt();
        displayMenu(result);
    }
    
    private void displayMenu(int menu)
    {
        switch(menu)
        {
            case 1:
            friends.start();
            startProcessing();
            break;
            case 2:
            dvds.start();
            startProcessing();
            break;
            case 3:
            loan.start();
            break;
            case 4:
            break;
            default:
            System.out.println("Invalid input");
            break;
        }
    }
}
